package com.roncoo.student.stu.service.impl;

import com.roncoo.student.stu.entity.UserFavorites;
import com.roncoo.student.stu.dao.UserFavoritesMapper;
import com.roncoo.student.stu.service.IUserFavoritesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jl
 * @since 2021-04-09
 */
@Service
public class UserFavoritesServiceImpl extends ServiceImpl<UserFavoritesMapper, UserFavorites> implements IUserFavoritesService {

    @Resource
    private UserFavoritesMapper mapper;
    @Override
    public List<UserFavorites> findAll(Integer userId) {
        return mapper.findAll(userId);
    }

    @Override
    public boolean findUserAndCourse(Integer userId,Integer courseNo) {
        List<UserFavorites> userAndCourse = mapper.findUserAndCourse(userId, courseNo);
        if (userAndCourse.size()>0){
            System.out.println(userAndCourse);
            return true;
        }else {
            return false;
        }
    }
}
